<?php get_header(); ?>

<div class="content-area">
    <main class="site-main">
    <?php if (have_posts()) : ?>
      <div class="posts-list">
            <?php while (have_posts()) : the_post(); ?>
                <article class="post-item">
                    <?php if (has_post_thumbnail()) : ?>
                            <div class="post-thumbnail">
                                <?php the_post_thumbnail(); ?>
                            </div>
                        <?php endif; ?>
                    <div class="post-content">
                        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                        <?php 
                          $content = get_the_content();
                          $excerpt = wp_trim_words($content, 80, '...');
                          echo '<p>' . $excerpt . '</p>';
                          ?>
                    </div>
                </article>
            <?php endwhile; ?>
        </div>
        <!-- 分页 -->
        <?php the_posts_pagination(); ?>
    <?php else : ?>
      <p><?php _e('没有找到文章', 'my-simple-theme'); ?></p>
    <?php endif; ?>
    </main>
    
    <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>